@isTest
private class testBatchtoretrofitOppEDC {
   
    static testMethod void testBatchtoretrofit() {
    
        BatchtoretrofitOppEDC bro = new BatchtoretrofitOppEDC();
        bro.querystring='select id,CloseDate,Upper_EDC__c,Project_Name__c,Date_of_Visit__c,Last_Call_Date_RO__c from Opportunity LIMIT 200 ';
        Test.startTest();
        
        EDC_for_opportunity__c edcopp=new EDC_for_opportunity__c();
        edcopp.Name='Test';
        edcopp.Project_Type__c='Casa';
        edcopp.EDC_from_Created_date__c='25';
        edcopp.EDC_from_Visit_date__c='30';
        edcopp.Upper_Limit__c='90';
        edcopp.Call_Attempt_Limit__c='7';
        edcopp.Call_Attempt_EDC__c='8';
        insert edcopp;
        
        Account a=new Account();
        a.FirstName='Test';
        a.LastName='One';
        a.Personal_Email__pc='test1@cg.com';
        insert a;
        
        Project_Name__c project=new Project_Name__c();
        project.Name='Test';
        project.Project_Type__c='Casa';
        insert project;
        
        Opportunity opp=new Opportunity();
        opp.Name='Test';
        opp.AccountId=a.Id;
        opp.closedate=date.newinstance(2012, 7, 2);
        opp.Date_of_Visit__c = date.newinstance(2012, 7, 20);
        opp.IsActive__c=true;
        opp.Visit_Form_No__c = '765423234';
        opp.Walk_in_Source__c = 'ClubCASA';
        opp.Project_Name__c=project.Id;
        opp.StageName='Qualified';
        opp.Upper_EDC__c =  date.newinstance(2012, 9, 5);
        
        insert opp;
        
        Call_Attempts__c call=new Call_Attempts__c();
        call.Opportunity__c = opp.Id;
        call.Project__c = project.Id;
        call.Call_Type__c = 'Email';
        call.Call_Attempt_Status__c = 'Visit Proposed';
        call.Next_Action_Date__c = system.today();
        call.Proposed_Date_of_Visit__c = date.newinstance(2012, 9, 1);
        call.Attempted_By__c = 'Presales';
        call.Call_Attempted_by__c = 'Group B';
        
        insert call;
        
        
        
        
        Database.executeBatch(bro,200);
        
        Test.stopTest();
        
       
    }
}